<template>
  <div>
    <div>
      <div class="font15 mt10 pl10">
        <span class="titletext ">{{titledata.title}}</span>
        <div class="graytext  mt10 font13">
          <span>工单编号：</span>
          <span class="titletext">{{titledata.pmInsId}}</span>
        </div>
      </div>
      <!-- 基本信息 -->
      <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
        <div class="blue_item" />
        <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">基础信息</span>
      </div>
      <van-field @click="tomsg()" readonly required name="businessId" :value="businessdata.businessId" label-width="5em"
                 label="商机编号：" />
      <van-field readonly required name="businessName" :value="businessdata.businessName" label-width="5em"
                 label="商机名称：" />
      <van-field readonly required name="projectEstablishNumber" :value="businessdata.projectEstablishNumber"
                 label-width="5em" label="项目编号：" />
      <van-field readonly required name="projectEstablishName" :value="businessdata.projectEstablishName"
                 label-width="5em" label="项目名称：" />
      <van-field readonly required name="competeType" :value="businessdata.competeType" label-width="5em"
                 label="竞争方式：" />
      <van-field readonly required name="projectModel" :value="businessdata.projectModel" label-width="7em"
                 label="项目实施类型：" />
      <van-field readonly name="projectServiceContent" :value="businessdata.projectServiceContent" label-width="7em"
                 label="项目实施类型：" />
      <van-field readonly name="projectType" :value="businessdata.projectType" label-width="5em" label="项目类型:" />
      <van-field readonly required name="contractRelationship" :value="businessdata.contractRelationship"   label-width="7em" label="合同对应关系：" autosize type="textarea" rows="1"/>
      <van-field readonly required name="supplierCode" :value="businessdata.supplierCode" label-width="7em"
                 label="计费单位编码:" autosize type="textarea" rows="1"/>
      <van-field readonly required name="supplierName" :value="businessdata.supplierName" label-width="7em"
                 label="计费单位名称:" autosize type="textarea" rows="1"/>
      <van-field readonly required name="contractRelationship" :value="businessdata.contractRelationship"
                 label-width="7em" label="合同对应关系：" />
      <van-field readonly required name="renewalOfContract" :value="zizhudata.renewalOfContract" label-width="7em" label="是否续约合同:" />
      <van-field readonly name="supplierCustomerAddress" :value="zizhudata.supplierCustomerAddress" label-width="9em" label="集团客户注册地址:" />
      <van-field readonly name="straightCustomrOweFee" :value="zizhudata.straightCustomrOweFee" label-width="12em" label="当前客户欠费金额（元）:" />
      <van-field readonly name="supplierCustomerUpDate" :value="zizhudata.supplierCustomerUpDate" label-width="9em" label="集团客户成立日期:" />
      <van-field readonly name="supplierCustomerDays" :value="zizhudata.supplierCustomerDays" label-width="9em" label="集团客户成立天数:" />
      <van-field readonly name="supplierCustomerScale" :value="zizhudata.supplierCustomerScale" label-width="11em" label="客户单位规模（人数）:" />
      <van-field readonly required name="autonomousImplemention" :value="zizhudata.autonomousImplemention||'否'"  label="是否自主实施:" label-width="7em" />
      <!-- 是否自主实施 “是” 有这一行 -->
      <van-field readonly required name="autonomousImplementionType"
                 :value="zizhudata.autonomousImplementionType" label="项目自主实施类型:" label-width="9em" />
      <van-field v-if="zizhudata.autonomousImplemention == '是'" readonly required name="autImplementScope"
                 :value="zizhudata.autImplementScope" label="自主实施范围:" label-width="7em" />
      <van-field readonly name="entrustedSalesModel" :value="zizhudata.entrustedSalesModel" label="是否受托代销项目:"
                 label-width="9em" />
      <van-field readonly name="isCommoditySales" :value="zizhudata.isCommoditySales" label-width="11em" label="是否存在商品销售收入:" />
      <van-field readonly name="mainAgentMode" :value="zizhudata.mainAgentMode" label-width="6em" label="主代理模式:" />

      <van-field readonly required name="industryBigTypeProvince" :value="businessdata.industryBigTypeProvince" label="省内行业大类：" label-width="7em" />
      <van-field readonly required name="industryBigTypeGroup" :value="businessdata.industryBigTypeGroup" label="集团行业大类：" label-width="7em" />
      <van-field readonly required name="industryMinTypeGroup" :value="businessdata.industryMinTypeGroup" label="集团行业小类：" label-width="7em" />
      <van-field readonly required name="industryAttribution" :value="businessdata.industryAttribution" label="15大行业名称：" label-width="7.5em" />
      <van-field readonly required name="industryNameOneLevel" :value="businessdata.industryNameOneLevel" label="行业一级名称：" label-width="7em" />
      <van-field readonly required name="industryNameTwoLevel" :value="businessdata.industryNameTwoLevel" label="行业二级名称：" label-width="7em" />

      <!--      视联网-->
      <van-field readonly name="isVideoNet" :value="zizhudata.isVideoNet=='1'?'是':'否'" label-width="10em" label="是否包含视联网能力:" />
      <div class="redtext font11" style="margin: 5px 15px 0px 15px;">
        视联网能力说明：当商机内容包含视联网关键字，如“视频、监控、雪亮、应急、摄像头、球机、枪机、千里眼、云视讯、和对讲”等，则选择“是”。
      </div>
      <van-field v-if="zizhudata.isVideoNet=='1'" readonly name="isVideoNetProduct" :value="zizhudata.isVideoNetProduct" label-width="12em" label="是否包含视联网自有产品:" />
      <van-field v-if="zizhudata.isVideoNet=='1'&&zizhudata.isVideoNetProduct=='是'" readonly name="videoNetProductAmount" :value="zizhudata.videoNetProductAmount" label-width="10em" label="视联网自有产品收入金额(不含税)(元):" />
      <div v-if="zizhudata.isVideoNet=='1'">
        <van-field readonly name="videoNetInfoAmountNo" :value="zizhudata.videoNetInfoAmountNo" label-width="10em" label="视联网能力收入金额(不含税)(元):" />
        <van-field readonly name="incomeRate" :value="zizhudata.incomeRate" label-width="13em" label="视联网能力收入占比（%）:" />
        <van-field readonly name="connectionsNum" :value="zizhudata.connectionsNum" label-width="9em" label="视联网能力连接数:" />
        <div class="redtext font11" style="margin: 5px 15px 0px 15px;">
          视联网连接数是指项目中涉及的终端数量，包括不限于监控摄像头、会议终端、对讲终端、行业定制终端、人脸识别终端、安消一体化设备等。
        </div>
      </div>
      <!--AI打标签-->
      <van-field readonly required name="isAiAbility" :value="fromdata.isAiAbility == 1 ? '是' : '否'" label="是否包含AI能力:" label-width="8em" />
      <van-field v-if="fromdata.isAiAbility == 1" readonly required name="aiAbilityType" :value="fromdata.aiAbilityType" label="AI能力分类:" label-width="6em" />
      <van-field v-if="fromdata.isAiAbility == 1" readonly required name="aiAbilityAmount" :value="fromdata.aiAbilityAmount" label="AI能力收入金额(含税)(万元):" label-width="14em" />
      <van-field v-if="fromdata.isAiAbility == 1" readonly required name="aiIncomeRate" :value="fromdata.aiIncomeRate" label="AI能力收入占比(%):" label-width="10em" />
      <div class="redtext font11" style="margin: 5px 15px 0px 15px;">
        AI能力说明: 当项目包含各类A业务场景，中是否包含安全产品*如智眉大模型、AI产品、AI行业应用、AI大模型服务等，则选择“是”。
      </div>
      <!--    安全产品-->
      <van-field readonly required name="isSafeProduct" :value="fromdata.isSafeProduct == 1 ? '是' : '否'" label="是否包含安全产品:" label-width="8.5em" />
      <van-field readonly required name="isSafeTrackProduct" :value="fromdata.isSafeTrackProduct == 1 ? '是' : '否'" label="是否包含安全赛道产品:" label-width="10.5em" />
      <van-field v-if="fromdata.isSafeTrackProduct == 1" readonly required name="safeTrackProductAmount" :value="fromdata.safeTrackProductAmount" label="安全赛道产品收入金额不含税（不含税，元）:" label-width="11em" />
      <van-field v-if="fromdata.isSafeProduct == 1" readonly required name="safeProductAmount" :value="fromdata.safeProductAmount" label="安全产品收入金额（不含税，元）:" label-width="11em" />
      <van-field v-if="fromdata.isSafeProduct == 1" readonly required name="safeIncomeRate" :value="fromdata.safeIncomeRate" label="安全产品收入占比(%):" label-width="11em" />
      <div class="redtext font11" style="margin: 5px 15px 0px 15px;">
        安全产品说明：当项目包含各类安全业务场景，安全业务场景指：在垂直行业ICT解项目中，提供等保合规类、密码安全类、数据安全类、工业安全类、供应链安全类、云安全类、车联网安全类、5G/6G安全、安全服务（咨询、规划、重保、攻防、应急响应、靶场、培训等）相关产品和支撑服务，帮助客户建立健全信息系统及网络安全防护体系，保护系统和数据不受威胁，提升其安全性、稳定性、可靠性和合规性等，则选择“是”。
      </div>
      <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
        <div class="blue_item" />
        <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">合同草稿信息</span>
      </div>
      <van-field readonly required name="contractSerialNumber" :value="businessdata.contractDrawUp.contractSerialNumber" label-width="6em" label="合同流水号：" />
      <van-field readonly  name="incExpTypeValue" :value="incExpTypeValue" label="收支类型：" label-width="5em" />
      <van-field readonly required name="contractName" :value="businessdata.contractDrawUp.contractName" label-width="7em" label="合同草稿名称：" autosize type="textarea" rows="1"/>
      <van-field readonly required name="contractAmount" :value="businessdata.contractAmount" label="合同含税总金额(元)：" label-width="10em" />
      <van-field readonly  name="contractNoAmount" :value="businessdata.contractNoAmount" label="合同不含税总金额(元)：" label-width="11em" />
      <van-field readonly required name="isProtocal" :value="businessdata.isProtocal=='Y'?'是':'否'" label-width="7em" label="是否补充协议：" />
      <historyAndSuggs id='target' :showHistory='showHistory' :historydata='historydata' :approveList='approveList' />

    </div>


  </div>
</template>
 
<script>
import { openFileUrl } from '@/store/openFile'
import historyAndSuggs from "@/views/srqr/historyAndSuggs.vue"
import {queryByType} from "@/api/dictapi";
import {Notify} from "vant";
export default {
  data() {
    return {
      showUpAndDownPop:false, 
      UpAndDownPopColumns:['是', '否'],
      showCalculateModePop:false, 
      CalculateModePopColumns:['主理人', '代理人'],
      showIsAttentionPop:false, 
      IsAttentionPopColumns:['是', '否'],
      incExpTypeValue:'',
    }
  },
  props: ['titledata','businessdata','fromdata','showHistory','historydata','approveList','zizhudata'],
  watch: {
    businessdata: {
      handler () { //这是vue的规定写法，当你watch的值发生变化的时候，就会触发这个handler，这是vue内部帮你做的事情
        this.getTypeValue();
      },
      deep: true,  // 可以深度检测到 obj 对象的属性值的变化
      immediate: true //刷新加载  立马触发一次handler
    }
  },
  methods: {
     tomsg () {
      document.getElementById('target').scrollIntoView({ behavior: 'smooth' })
    },
    openFileUrlfun(value) {
      this.$router.push(
        {
          name: 'fileview',
          query: {
            openFileUrl: openFileUrl(value)
          }
        }
      );
    },
    UpAndDownPopConfirm(value) {
      this.showUpAndDownPop = false
      this.fromdata.upAndDown = value
    },
    CalculateModePopConfirm(value) {
      this.showCalculateModePop = false
      this.fromdata.calculateMode = value
    },
    IsAttentionPopConfirm(value) {
      this.showIsAttentionPop = false
      this.fromdata.isAttention = value
    },
    getTypeValue(){
      //收支类型
      if (this.businessdata.contractDrawUp?.incExpType){
        queryByType({ dictType:'incExpType'} )
            .then((result) => {
              if (!result.data) {
                Notify(result.message);
                return;
              }
              for(var i=0;i<result.data.data.length;i++){
                if(result.data.data[i].value==this.businessdata.contractDrawUp?.incExpType){
                  this.incExpTypeValue = result.data.data[i].name;
                }
              }
            })
      }
    }
  },
  computed: {
    isCWSPLocation: function () {
      return this.location=='dict.accountingApproval'
    },
  },
  components: {
    historyAndSuggs
  },
}
</script>
 
<style>
.tables.el-table .cell {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-all;
    line-height: 15px;
    padding-left: 5px;
    padding-right: 5px;
}
</style>